var newsTable;
//获取测评记录
function getEvaluationRecordList(name) {
    if (typeof newsTable !== 'undefined') {
        newsTable.fnPageChange('first');
        return;
    }
    
    var i = 1;
    newsTable = $("#newsList").DataTable({
        "sAjaxSource": _path + "/evaluationRecord/queryByPage",
        "fnServerParams": function (aoData) {
            aoData.push(
                { "name": "kindergartenId", "value": $("#kindergartenId").val() },
                { "name": "interestClassId", "value": $("#interestClassId").val() },
                { "name": "babyAccount", "value": $("#babyAccount").val() },
                { "name": "babyName", "value": $("#babyName").val() },
                { "name": "fromDate", "value": $("#fromDate").val() },
                { "name": "toDate", "value": $("#toDate").val() }
            );
        },
        "sServerMethod": "POST",
        "sAjaxDataProp": "dataList",
        "fnCreatedRow": function () {
            i++;
        },
        "fnPreDrawCallback": function () {
            i = 1;
        },
        "aoColumns": [
            { "sTitle": "序号", "sWidth": "2%",
                "mData": function () {
                    return i;
                }
            },
            { "sTitle": "宝贝帐号", "mData": "babyAccount", "sWidth": "10%" },
            { "sTitle": "宝贝姓名", "mData": "babyName", "sWidth": "10%" },
            { "sTitle": "测评类型", "mData": "studyType", "sWidth": "10%" },
            { "sTitle": "创建时间", "mData": "insertTime", "sWidth": "10%" },
        ]
    });
}



//获取所有幼儿园
function queryAllKindergarten(){
	 $.ajax({										
		    url: _path + "/evaluationRecord/queryAllKindergarten",
		    type: "POST",
		    dataType: "json",
		    async: false,
		    success: function(jsonMap) {
		    	var list = jsonMap.dataList;
		        if(list.length>0){
		        	for(var i=0;i<list.length;i++){
						var k = list[i];
						var  op = "<option value="+k.id+" >"+k.name+"</option>";
						$("#kindergartenId").append(op);
		        	}
		        }
		    }
		});
}

//获取所有兴趣班
function queryAllInterestClass(){
	var kId = $("#kindergartenId").val();
	 $.ajax({										
		    url: _path + "/evaluationRecord/queryAllInterestClass?kId="+kId,
		    type: "POST",
		    dataType: "json",
		    async: false,
		    success: function(jsonMap) {
		    	var list = jsonMap.dataList;
		    	$("#interestClassId").html("");
		    	$("#interestClassId").append("<option selected value=''>请选择</option>");
		        if(list.length>0){
		        	for(var i=0;i<list.length;i++){
						var interest = list[i];
						var  op = "<option value="+interest.id+" >"+interest.intclassName+"</option>";
						$("#interestClassId").append(op);
		        	}
		        }
		    }
		});
}